<template>
  <min-dialog-box class="relieve" v-if="!tools.conference.isHost(userInfo.user_id) && cf_relieve" @relieveBtnEvent="relieve" @keepBtnEvent="keep" :dialogData="dialogData"></min-dialog-box>
</template>

<script>
import { mapState } from 'vuex'
import { sendSock } from '@/utils/socketSend'

export default {
  name: 'relieve',
  data () {
    return {
      dialogData: {
        mainTips: ['主持人已解除静音'],
        btnList: [{
          name: '解除静音',
          color: 'blue',
          type: 'relieve'
        }, {
          name: '保持静音',
          color: 'white',
          type: 'keep'
        }]
      }
    }
  },
  computed: {
    ...mapState('conferenceRoom', ['cf_id', 'cf_relieve']),
    // 本人信息
    userInfo () {
      return this.$store.state.user.userInfo
    }
  },
  methods: {
    // 解除静音
    relieve () {
      sendSock({
        type: '4.1.20',
        body: {
          cf_id: this.cf_id,
          cf_operation: true
        }
      })
      this.$store.commit('conferenceRoom/set_cf_relieve', false)
    },
    // 保持静音
    keep () {
      this.$store.commit('conferenceRoom/set_cf_relieve', false)
    }
  }
}
</script>

<style scoped lang="scss">

</style>
